<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html>
<%@include file="../common/base.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="user-scalable=no" />
<link rel="stylesheet" type="text/css" href="./app/css/common.css" />
<link rel="stylesheet" type="text/css" href="./app/css/p001.css" />
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<title></title>
</head>

<body>
<div class="content">
	<img alt="logo" src="./app/image/logo01.png" style="width: 90%;margin-top: 15%" />
	<div style="color: #fff;font-size: 42px;">一分钟创建你最有范儿的社交名片</div>
	<div class="register">
		<div style="margin-top: 5%;">
			<input type="text" class="mInput" id="appUserName" value="用户名" onfocus="$(this).val('')" />
			<input type="text" class="mInput" id="appEmail"value="email" onfocus="$(this).val('')" />
			<input type="text" class="mInput" value="密码" onfocus="$(this).hide();$('#passReg').show().focus();" />
			<input type="password" class="mInput" id="passReg" style="display: none;" />
			<input type="text" class="mInput" value="确认密码" onfocus="$(this).hide();$('#rePassReg').show().focus();" />
			<input type="password" class="mInput" id="rePassReg" style="display: none;" />
		</div>
		<div class="regOrLog" onclick="appRegister();">注&nbsp;&nbsp;册</div>
		<div class="regOrLogButton">登&nbsp;&nbsp;陆</div>
	</div>
	<div class="login" style="display: none;">
		<div style="margin-top: 5%;">
			<input type="text" class="mInput" value="用户名" onfocus="$(this).val('')" />
			<input type="text" class="mInput" value="密码" onfocus="$(this).hide();$('#passLog').show().focus();" />
			<input type="password" class="mInput" id="passLog" style="display: none;" />
		</div>
		<div class="regOrLog">登&nbsp;&nbsp;陆</div>
		<div class="regOrLogButton">注&nbsp;&nbsp;册</div>
	</div>
</div>
<script type="text/javascript">
$(function() {
	$(".regOrLogButton").click(function(){
		$(".register").toggle();
		$(".login").toggle();
	});
})
function appRegister(){
	  var name  = $("#appUserName").val();
	  var pwd = $("#passReg").val();
	  var psw_com = $("#rePassReg").val();
	  var email = $("#appEmail").val();
	  if(name==""){
		  alert("用户名不能为空");return;
	  }
	  if(pwd==""){
		  alert("密码不能为空");return;
	  }
	  if(psw_com!=pwd){
		  alert("确认密码不一致");return;
	  }
	  if(email==""){
		  alert("邮箱不能为空");return;
	  }
	  var objp={};
	  objp.userName=name;
	  objp.password =pwd;
	  objp.email =email;
	   $.ajax({
			  url: '${path}/core/register',
			  type: 'POST',
			  timeout: 30000,
			  cache : false,
		      data :objp,
		      async: false,
			  success:function(msg){
				    window.location.href='${path}/appThanks.jsp';
			   },
			  failure:function(msg){
			   		alert("注册失败!");
			   		
			   },
			   error:function(msg){
				   alert(eval('('+msg.responseText+')').error_text); 
			   }
		});
}
</script>
</body>
</html>
